package cn.leelei.hibernate.entity;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;

/**
 * 一对一关系映射
 * @author Nike
 *
 */
//添加注解实体类
@Entity
//添加注解表表名为User
@Table(name="IDcard")
public class IDcard {
	//映射主键
	@Id
	//主键的生成策略
	//自增长IDENTITY
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer id;//用户表的id 字段
	@Column(name="number")//普通列名
	private String number;//用户表的UserName 字段
	
	@OneToOne
	@JoinColumn(name="role_id",unique=true)
	private Role role;//角色
	

	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public Role getRole() {
		return role;
	}

	public void setRole(Role role) {
		this.role = role;
	}
	
	
	
	
    
}
